import unittest

import cv2
import torch.utils.data

import modelopr
import preprocess
import numpy


class Test(unittest.TestCase):
    def test_train(self):
        modelopr.train()

    def test_test(self):
        print(modelopr.test())

    def test_dataloader(self):
        print(preprocess.get_dataloader("mnist", 0.7, 0.2))

    def test_dataset(self):
        train_dataset, valid_dataset, test_dataset = preprocess.get_dataset("mnist", 1, 1)
        print(train_dataset[0])

    def test_split(self):
        x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
        y = torch.tensor([1, 2, 3])
        dataset = torch.utils.data.TensorDataset(x, y)
        train, valid, test = torch.utils.data.random_split(dataset, [2, 0, 1])

    def test_int(self):
        print(int(0.9999))

    def test_img(self):

        cv2.waitKey(0)
        cv2.destroyAllWindows()
